<template>
    <div id="drag">item</div>
</template>

<script>
    import { ipcRenderer } from 'electron';

    export default {
        name: 'base64',
        mounted() {
            document.addEventListener('drop', (e) => {
                e.preventDefault();
                const files = e.dataTransfer.files;
                const pathArr = [];
                for (let i = 0; i < files.length; i++) {
                    const file = files[i];
                    pathArr.push(file.path);
                }
                ipcRenderer.send('ondragstart', pathArr);
            });
            document.addEventListener('dragleave', (e) => { // 拖后放
                e.preventDefault();
            });
            document.addEventListener('dragenter', (e) => { // 拖进
                e.preventDefault();
            });
            document.addEventListener('dragover', (e) => { // 拖来拖去
                e.preventDefault();
            });
        },
    };
</script>

<style>
    #drag{
        padding: 80px;
    }
</style>
